package mytag;
import java.io.*;
import java.sql.*;
import javax.servlet.jsp.tagext.*;
import javax.servlet.jsp.*;
import java.util.*;

public class TableShow extends SimpleTagSupport {
	
	private HashMap<Integer,String>[] hp=new HashMap[42];
	String [] time={"8:00-9:50","10:00-11:50","12:00-13:50","14:00-15:50","16:00-17:50","18:00-19:50"};
	
	public void setHp(HashMap<Integer,String>[] hp)
	{
		this.hp=hp;
	}
	public void doTag ()throws JspException,IOException
	{
		JspWriter out=getJspContext().getOut();		
		
		for(int i=1;i<7;i++)
		{
			
			out.println("<tr bordercolor=\"#1E7ACE\">");
			out.println("<th scope=\"row\">"+time[i-1]+"</th>");
			for(int j=1;j<8;j++)
			{
				Iterator<Integer> iter;
				int num=(i-1)*7+j-1;
				HashMap <Integer,String> p=hp[num];
				if(p!=null)
					iter=p.keySet().iterator();
				else{
					out.println("<td border=\"1\">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td>");
					continue;
				}
				out.println("<td  border=\"1\">");
				while(iter.hasNext())
				{
					int id=iter.next();
					out.println(""+p.get(id));
				}
				out.println("</td>");
			}
			out.println("</tr>");
		}
		 
	}
	

}
